﻿@using MvcPaging
@model IPagedList<Classified.Domain.Entities.ClassifiedAd>
@{
    ViewBag.Title = "List of Classified Ads";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<h1>
    List <small>of Classified Ads</small></h1>
<p align="right" style="float: left" class="noprint">
    <a href="@Url.Action("Create", "Classified")" class="btn primary newDetailLocation btn-info">
        <i class="icon-plus icon-white"></i> Create new</a>
    <p />
    <table class="table table-bordered table-striped">
        <thead>
            <th>
                Name
            </th>
            <th>
                Category Name
            </th>
            <th>
                Location Name
            </th>
            <th width="8%">
                Created On
            </th>
            <th width="4%">
                Active
            </th>
            <th class="noprint" width="30%">
            </th>
        </thead>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Title)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ClassifiedCategories.Name)
                </td>
                <td>
                    @{
            int i = 0;
                    }
                    @foreach (var l in item.Locations)
                    {

                        if (i > 0)
                        {
                        <text>,</text>
                        }
                        i++;
                        @Html.DisplayFor(modelItem => l.Name)
                    }
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CreatedOnUtc)
                </td>
                <td>
                    @item.IsActive
                </td>
                <td>
                    <a href="@Url.Action("Edit", "Classified", new { id = item.Id })" idLocationDetails ="@item.Id"  class="btn btn-primary editLocationDetails" idLocationDetails="@item.Id">
                        <i class=" icon-comment icon-white"></i>&nbsp;Comment(@item.ClassifiedComments.Count())</a>
                    
                    
                    

                    <a href="@Url.Action("Edit", "Classified", new { id = item.Id })" idLocationDetails ="@item.Id"  class="btn btn-success editLocationDetails" idLocationDetails="@item.Id">
                        <i class=" icon-edit icon-white"></i>&nbsp;Edit</a> <a href="@Url.Action("Delete", "Classified", new { id = item.Id })" class="btn btn-danger" onclick="return confirm('Are you sure you wish to delete this Classified?');">
                                                                    <i class="icon-trash icon-white"></i>Delete</a>
                </td>
            </tr>
        }
    </table>
    <div class="pagingContainer noprint">
        @Html.Pager(Model.PageSize, Model.PageNumber, Model.TotalItemCount)
    </div>
